﻿using WPFServices.Models;
using WPFServices.Models.Domain;


namespace WPFServices.Services.DomainService.Processinfo
{
    public class ProcessService
    {
        private readonly ApiClient _apiClient;

        public ProcessService()
        {
            _apiClient = new ApiClient();
        }

        /// <summary>
        /// 获取所有流程
        /// </summary>
        public async Task<List<ProcessesDto>> SearchProcessAsync()
        {
            var result = await _apiClient.GetAsync<List<ProcessesDto>>("Process/GetProcess");

            if (result.IsSuc && result.code == ResultCode.Ok)
            {
                return result.data ?? new List<ProcessesDto>();
            }
            else
            {
                throw new Exception($"获取流程列表失败: {result.msg}");
            }
        }

    }
}